package com.mdd.front.vo.order;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;

@Data
@ApiModel("租赁订单详情详情")
public class OrderLeaseDetailsDetailVo implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "编号")
    private Long id;
    @ApiModelProperty(value = "订单编码")
    private Long orderId;
    @ApiModelProperty(value = "用户id")
    private Long userId;
    @ApiModelProperty(value = "车辆id")
    private Long vehicleId;
    @ApiModelProperty(value = "服务类型")
    private Integer serviceType;
    @ApiModelProperty(value = "租赁类型 1、月 2、周 3、日")
    private Integer leaseType;

    @ApiModelProperty(value = "租赁周期")
    private Integer leasePeriod;
    @ApiModelProperty(value = "首付")
    private BigDecimal downPayments;
    @ApiModelProperty(value = "原押金")
    private BigDecimal deposit;
    @ApiModelProperty(value = "实收押金")
    private BigDecimal actualDeposit;
    @ApiModelProperty(value = "每期租金")
    private BigDecimal eachIssue;
    @ApiModelProperty(value = "其他费用")
    private BigDecimal otherExpenses;
    @ApiModelProperty(value = "到期日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date dueDate;
    @ApiModelProperty(value = "完成时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date completionTime;

    @ApiModelProperty(value = "每期租金Str")
    private String eachIssueStr;
    public String getEachIssueStr() {
        eachIssueStr =  eachIssue.setScale(0, RoundingMode.HALF_DOWN).toString(); // 设置保留两位小数并舍入
        if(leaseType.equals(1)){
            eachIssueStr = eachIssueStr + "/月";
        }else  if(leaseType.equals(2)){
            eachIssueStr = eachIssueStr + "/周";
        }else  if(leaseType.equals(3)){
            eachIssueStr = eachIssueStr + "/日";
        }
        return eachIssueStr;
    }
}
